package cn.edu.zafu.bigdata.x.bd121.shape;

/**
 * 长方形类
 *
 * @author 202211091021
 */
public class Rectangle extends Shape {

    /**
     * 长方形的长
     */
    private double length;

    /**
     * 长方形的宽
     */
    private double width;

    /**
     * 计算面积
     *
     * @return 面积
     */
    @Override
    public double area() {
        return this.length * this.width;
    }

    /**
     * 计算周长
     *
     * @return 周长
     */
    @Override
    public double perimeter() {
        return 2 * this.length + 2 * this.width;
    }

    // region Java Bean
    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public Rectangle() {
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    //endregion
}
